package 简单工厂;

/**
 * @author wz<br>
 * @version 1.0<br>
 * @ClassName FactoryPatternDemo
 * @<Description> TODO
 * @date 2021/12/7 16:49<br>
 */
public class FactoryPatternDemo {
  public static void main(String[] args) {
    //
    ShapeFactory shapeFactory=new ShapeFactory();

    //获取Circle的对象，并调用它的draw方法
    Shape shape1=shapeFactory.getShape("CIRCLE");

    //获取Circle的draw方法
    shape1.draw();

    //获取Rectangle的对象，并调用它的draw方法
    Shape shape2=shapeFactory.getShape("RECTANGLE");
    shape2.draw();

    //获取Square的对象，并调用它的draw方法
    Shape shape3=shapeFactory.getShape("SQUARE");
    shape3.draw();

  }
}
